package com.token.iot.bratterycharging.gateway.business;

import java.util.Map;

import org.springframework.stereotype.Component;

import com.outstanding.framework.core.PendingException;
import com.token.iot.bratterycharging.gateway.IDGeneration;
import com.token.iot.bratterycharging.gateway.utils.ByteUtil;

/**
 * 硬件版本号
 * @author chenzhixuan
 *
 */
@Component("QBBDuplexProcessor")
public class QBBDuplexProcessor extends DuplexProcessor {

	@Override
	public String request(String imei, Map<String, String> params) throws PendingException {
		String c = "QBB";
		String sessionId = IDGeneration.createSeesionID();
		String command = null;
		command = c + sessionId + "/0" ;
		loger.info("the send =" + new String(command));
		byte[] cc = ByteUtil.addFlag(command.getBytes());
		context.writeAndFlush(cc);
		return sessionId;

	}

	@Override
	public String response(String response) throws PendingException {
		String val = response.substring(14);
		return val;

	}

}
